package com.atjinggu.jinggumail.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author jingming
 * @Type CustomRedissonConfig.java
 * @Desc
 * @date 2021/1/20 14:30
 */
@Configuration
public class CustomRedissonConfig {


    @Bean(destroyMethod="shutdown")
    public RedissonClient redisson()throws IOException {
    // 默认连接地址 127.0.0.1:6379
     //RedissonClient redisson = Redisson.create();
    Config config = new Config();
    config.useSingleServer().
            // 可以用"rediss://"来启用SSL连接
    setAddress("redis://192.168.203.11:6379");
    RedissonClient redisson = Redisson.create(config);
    return redisson;
}

}